package com.dwb.controller;

import com.dwb.entity.SRuzhu;
import com.dwb.result.Result;
import com.dwb.service.SRuzhuService;
import com.dwb.service.SShenpiService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Author manke
 * @Date 2020/6/28 20:16
 * @Version 0.0.1
 */
@Api(value = "SRuzhuController",description = "企业入住控制器")
@RestController
@RequestMapping("/SRuzhu")
public class SRuzhuController {

    @Autowired
    private SRuzhuService sRuzhuService;
    @Autowired
    private SShenpiService sShenpiService;

    @PostMapping("/updateState")
    @ApiOperation(value = "updateState",notes = "更改审核状态")
    public Result<String> updateState(@RequestBody Map<String,String> parameters){
        sShenpiService.updateState(parameters);
        return Result.newSuccess();
    }


    /**
     * 获取企业审核列表
     * @param parameters
     * @return
     */
    @PostMapping("/getList")
    @ApiOperation(value = "getList",notes = "获取企业审核列表")
    public Result<PageInfo<SRuzhu>> getList(@RequestBody Map<String ,String> parameters){
        PageInfo<SRuzhu> list = sRuzhuService.getList(parameters);
        Result<PageInfo<SRuzhu>> result = Result.newSuccess();
        result.setDataMap(list);
        return result;
    }

    /**
     * 查看服务商信息详情
     * @param parameters
     * @return
     */
    @PostMapping("/gerInfo")
    @ApiOperation(value = "gerInfo",notes = "查看服务商信息详情")
    public Result<SRuzhu> gerInfo(@RequestBody Map<String ,String> parameters){
        SRuzhu sRuzhu = sRuzhuService.getInfo(parameters);
        Result<SRuzhu> result = Result.newSuccess();
        result.setDataMap(sRuzhu);
        return result;
    }





}
